      subroutine systempswigp(P,nt,nrec,dt,drec,ft,f2,filename,title,label1,label2,wbox,d1num,d2num,iprint)


      implicit none
      real ::P(nt,nrec)
      integer nrec,nt
      character*12 filename
      character*20 :: title,label1,label2
      double precision :: wbox,hbox,ft
      double precision :: drec,dt,f2,d1num,d2num
      integer :: iprint !< indica se plotará ou não a chamada pswigp na tela
      character*1, parameter:: apos=achar(39)! apostrophe
      character*5 :: chnt,chnrec
      character*10 :: chdt,chdrec,chd1num,chd2num,chwbox,chhbox,chft,chf2




!       write(*,*)
!       write(*,*)
!       write(*,*)'**********************************  PSWIGP  *********************************'

      if(nt.lt.10)then
	  write(chnt,'(i1)')nt
	  chnt= '0000'//chnt
      elseif(nt.lt.100)then
	  write(chnt,'(i2)')nt
	  chnt= '000'//chnt
      elseif(nt.lt.1000)then
	  write(chnt,'(i3)')nt
	  chnt= '00'//chnt
      elseif(nt.lt.10000)then
	  write(chnt,'(i4)')nt
	  chnt= '0'//chnt
      elseif(nt.lt.100000)then
	  write(chnt,'(i5)')nt
      endif

      if(nrec.lt.10)then
	  write(chnrec,'(i1)')nrec
	  chnrec = '0000'//chnrec
      elseif(nrec.lt.100)then
	  write(chnrec,'(i2)')nrec
	  chnrec = '000'//chnrec
      elseif(nrec.lt.1000)then
	  write(chnrec,'(i3)')nrec
	  chnrec = '00'//chnrec
      elseif(nrec.lt.10000)then
	  write(chnrec,'(i4)')nrec
	  chnrec = '0'//chnrec
      elseif(nrec.lt.100000)then
	  write(chnrec,'(i5)')nrec
      endif

	  write(chdrec,'(E10.4)')drec
!       if(drec.lt.10.)then
! 	  write(chdrec,'(f4.2)')drec
!       elseif(drec.lt.100.)then
! 	  write(chdrec,'(f5.2)')drec
!       elseif(drec.lt.1000.)then
! 	  write(chdrec,'(f6.2)')drec
!       elseif(drec.lt.10000.)then
! 	  write(chdrec,'(f7.2)')drec
!       endif

	  write(chdt,'(E10.4)')dt
!       if(dt.lt.10.)then
! 	  write(chdt,'(f4.2)')dt
!       elseif(dt.lt.100.)then
! 	  write(chdt,'(f5.2)')dt
!       elseif(dt.lt.1000.)then
! 	  write(chdt,'(f6.2)')dt
!       elseif(dt.lt.10000.)then
! 	  write(chdt,'(f7.2)')dt
!       endif

	  write(chd1num,'(E10.4)')d1num
!       if(d1num.lt.10.)then
! 	  write(chd1num,'(f4.2)')d1num
!       elseif(d1num.lt.100.)then
! 	  write(chd1num,'(f5.2)')d1num
!       elseif(d1num.lt.1000.)then
! 	  write(chd1num,'(f6.2)')d1num
!       elseif(d1num.lt.10000.)then
! 	  write(chd1num,'(f7.2)')d1num
!       endif

	  write(chd2num,'(E10.4)')d2num
!       if(d2num.lt.10.)then
! 	  write(chd2num,'(f4.2)')d2num
!       elseif(d2num.lt.100.)then
! 	  write(chd2num,'(f5.2)')d2num
!       elseif(d2num.lt.1000.)then
! 	  write(chd2num,'(f6.2)')d2num
!       elseif(d2num.lt.10000.)then
! 	  write(chd2num,'(f7.2)')d2num
!       endif

	  write(chwbox,'(E10.4)')wbox
!       if(wbox.lt.10.)then
! 	  write(chwbox,'(f4.2)')wbox
!       elseif(wbox.lt.100.)then
! 	  write(chwbox,'(f5.2)')wbox
!       elseif(wbox.lt.1000.)then
! 	  write(chwbox,'(f6.2)')wbox
!       elseif(wbox.lt.10000.)then
! 	  write(chwbox,'(f7.2)')wbox
!       endif

      hbox = 0.75*wbox 
	  write(chhbox,'(E10.4)')hbox
!       if(hbox.lt.10.)then
! 	  write(chhbox,'(f4.2)')hbox
!       elseif(hbox.lt.100.)then
! 	  write(chhbox,'(f5.2)')hbox
!       elseif(hbox.lt.1000.)then
! 	  write(chhbox,'(f6.2)')hbox
!       elseif(hbox.lt.10000.)then
! 	  write(chhbox,'(f7.2)')hbox
!       endif

      write(chf2,'(E10.4)')f2
!       if(abs(f2).lt.10.)then
! 	  if(f2.ge.0)write(chf2,'(f4.2)')f2
! 	  if(f2.lt.0)write(chf2,'(f5.2)')f2
!       elseif(abs(f2).lt.100.)then
! 	  if(f2.ge.0)write(chf2,'(f5.2)')f2
! 	  if(f2.lt.0)write(chf2,'(f6.2)')f2
!       elseif(abs(f2).lt.1000.)then
! 	  if(f2.ge.0)write(chf2,'(f6.2)')f2
! 	  if(f2.lt.0)write(chf2,'(f7.2)')f2
!       elseif(abs(f2).lt.10000.)then
! 	  if(f2.ge.0)write(chf2,'(f7.2)')f2
! 	  if(f2.lt.0)write(chf2,'(f8.2)')f2
!       endif

	  write(chft,'(E10.4)')ft
!       if(ft.lt.10.)then
! 	  write(chft,'(f4.2)')ft
!       elseif(ft.lt.100.)then
! 	  write(chft,'(f5.2)')ft
!       elseif(ft.lt.1000.)then
! 	  write(chft,'(f6.2)')ft
!       elseif(ft.lt.10000.)then
! 	  write(chft,'(f7.2)')ft
!       endif


      open(1,file=filename//'.bin',status="unknown",form="unformatted",access="direct",recl=4*Nt*Nrec)
      write(1,rec=1)P
      close(1)


      call system('pswigp <'//filename//'.bin'//' n1='//chnt//' d1='//chdt//' n2='//chnrec//' d2='//chdrec//&
		& ' f1='//chft//' f2='//chf2//' f2num='//chf2//&
		& ' title='//apos//title//apos//' label1='//apos//label1//apos//&
		& ' label2='//apos//label2//apos//&
		& ' wbox='//chwbox//' hbox='//chhbox//' d1num='//chd1num//' d2num='//chd2num//&
		& ' labelsize=12 titlesize=18 verbose=0>'//filename//'.ps  &')


      if(iprint.eq.1)then
      write(*,*)'pswigp <'//filename//'.bin'//' n1='//chnt//' d1='//chdt//' n2='//chnrec//' d2='//chdrec//&
		& ' f1='//chft//' f2='//chf2//' f2num='//chf2//&
		& ' title='//apos//title//apos//' label1='//apos//label1//apos//&
		& ' label2='//apos//label2//apos//&
		& ' wbox='//chwbox//' hbox='//chhbox//' d1num='//chd1num//' d2num='//chd2num//&
		& ' labelsize=12 titlesize=18 verbose=0>'//filename//'.ps  &'
      endif


      return

!  151  format(//a390//)
      end